<?php
require_once '../class/control.class.php';
if($_GET['editar']){
	$obj = new Control('consultar','usuarios',$_GET['editar']);
	$obj->Consult();
	$con = $obj->result->lista;
}
?>
<div id="load"><img src="imagens/wait.gif" /></div>
<div><span id="efeito" >Cadastrar</span>
	<div id="box1">
		<form id="formUsuarios" method="post" enctype="multipart/form-data" >
			<table width="80%" border="0" cellspacing="5" cellpadding="0" align="center">
				<tr>
					<td>Login:</td>
					<td colspan="2"><input name="login" id="login" type="text" class="input" value="<?php echo $_GET['editar'] ? $con['login'] : ''; ?>" /></td>
					<td></td>
				</tr>
				<tr>
					<td>Senha:</td>
					<td colspan="2"><input name="senha" id="senha" type="text" class="input" /></td>
					<td></td>
				</tr>
				<tr align="right">
					<td colspan="3">
						<input type="hidden" name="pagina" 	id="pagina" value="Usuarios" />
						<?php 
						if($_GET['editar']){
							echo '<input type="hidden" name="acao" 			id="acao" 			value="update" />';
							echo '<input type="hidden" name="idusuarios" 	id="idusuarios"	 	value="',$_GET['editar'],'" />';
						}else{
							echo '<input type="hidden" name="acao" 	id="acao" 	value="insert" />';
						}
						?>	
						<input type="submit" value="Cadastrar" />
					</td>
				</tr>
			</table>
		</form>
	</div>
	<span id="efeito" >Listar / Editar / Excluir Cadastrados</span>
	<div id="box2">
		<?php
			$lst = new Control('listar','usuarios','');
			$lst->Lister();
			echo $lst->result->lista;
		?>
	</div>
	<script type="text/javascript"> 
        $(document).ready(function() { 
        	var options = { 
        			beforeSubmit:  loading,
        		    success:    sucesso,
        		    url:    '../class/server.php'
        		};
            $('#formUsuarios').ajaxForm(options); 
        }); 
    </script>
</div>